<?php
defined('_JEXEC') or die('Restricted access');
require_once( dirname(__FILE__).DS.'helper.php' );

	
	// echo "<pre>";
// print_r();
// echo "</pre>";
if(isset($_GET['id']))
{

		// $_SESSION['abc']='abcdef2qqqww';
		// global $abcdef;
		// $abcdef='abcdef2';
		// echo "2222";
		// exit;

		$id=mysql_real_escape_string($_GET['id']);

		$value = sanphamHelper::getdetail($id);
		
		// $link_cat= BASE_URL.'/'.$content['cat_alias'].'.html';
		// $brvalue[]=$content['cat_title'].'#$#'.$link_cat;
		// $brvalue[]=$content['title'].'#$#';
		// ComponentLibs::breadcrumbs($brvalue);
		
		
			$_SESSION['title']=$value['tensp'];
			$_SESSION['description']=$value['meta_description'];
			$_SESSION['keywords']=$value['meta_keyword'];
			
		include( dirname(__FILE__).DS.'tmpl'.DS.'detail'.DS.'abc.php' );
}else
{
		$number=12;
		if(isset($_GET['start'])){
			$start=$_GET['start'];
		}else{
			$start=0;
		}
		
		// $ordering
		//TODO: lay du lieu theo param ( secsion hay category)
		// $where='sectionid=2';
		// $where='catid=8';
		$where='';
		$data = sanphamHelper::getAllData($start,$number,'',$where);
		// echo "<pre>";
		// print_r($data);
		// echo "</pre>";
		// exit;
		//TODO: breadcrumb
		$brvalue[]=$ComponentName.'#$#';
		ComponentLibs::breadcrumbs($brvalue);
		
		
		$base_url ='?';
		$tongsodong=$data['number'];
		$pagintion = HamhaydungLibs::pagenav($base_url, $start, $tongsodong, $number);
		
		$_SESSION['title']='Sản phẩm';
		// $_SESSION['description']='234567';
		// $_SESSION['keywords']='metakey';
			
		include( dirname(__FILE__).DS.'tmpl'.DS.'list'.DS.'blog.php' );


}
?>
